<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>更新课程</title>
    <!-- 可选的样式表链接 -->
    <link rel="stylesheet" type="text/css" href="/css/styles.css" />
</head>
<body>
<h2>更新课程</h2>
<form th:action="@{/course/updateCourse}" th:object="${course}" method="post">
    <!-- 课程号，由模型传递并预填充 -->
    <div>
        <label for="cno">课程号</label>
        <input type="text" id="cno" th:field="*{cno}" th:readonly="true" required />
        <!-- 假设 Course 类的属性名为 id，且为不可修改 -->
        <span th:if="${#fields.hasErrors('cno')}" th:errors="*{cno}"></span>
    </div>

    <!-- 课程名称 -->
    <div>
        <label for="cname">课程名</label>
        <input type="text" id="cname" th:field="*{cname}" required />
        <span th:if="${#fields.hasErrors('cname')}" th:errors="*{cname}"></span>
    </div>

    <!-- 课程时间 -->
    <div>
        <label for="ctime">学时</label>
        <input type="number" id="ctime" th:field="*{ctime}" />
        <!-- 假设 Course 类的属性名为 hours -->
        <span th:if="${#fields.hasErrors('ctime')}" th:errors="*{ctime}"></span>
    </div>

    <!-- 课程学分 -->
    <div>
        <label for="ccredit">学分</label>
        <input type="number" id="ccredit" th:field="*{ccredit}" />
        <span th:if="${#fields.hasErrors('ccredit')}" th:errors="*{ccredit}"></span>
    </div>

    <!-- 提交按钮 -->
    <div>
        <button type="submit">提交</button>
    </div>
</form>
</body>
</html>